FIND_PATH(BULLET_INCLUDE_DIR btBulletCollisionCommon.h)

IF (WIN32)

        IF (NOT DEBUG)
                FIND_LIBRARY(BULLET_dynamics_LIB bulletdynamics)
                FIND_LIBRARY(BULLET_collision_LIB bulletcollision)
                FIND_LIBRARY(BULLET_softbody_LIB bulletsoftbody)
                FIND_LIBRARY(BULLET_linearmath_LIB linearmath)
                FIND_LIBRARY(BULLET_math_LIB bulletmath)

                FIND_LIBRARY(lib_BULLET_dynamics_LIB libbulletdynamics)
                FIND_LIBRARY(lib_BULLET_collision_LIB libbulletcollision)
                FIND_LIBRARY(lib_BULLET_softbody_LIB libbulletsoftbody)
                FIND_LIBRARY(lib_BULLET_linearmath_LIB liblinearmath)
                FIND_LIBRARY(lib_BULLET_math_LIB libbulletmath)

        ELSE (NOT DEBUG)
                FIND_LIBRARY(BULLET_dynamics_LIB bulletdynamics_d)
                FIND_LIBRARY(BULLET_collision_LIB bulletcollision_d)
                FIND_LIBRARY(BULLET_softbody_LIB bulletsoftbody_d)
                FIND_LIBRARY(BULLET_linearmath_LIB linearmath_d)
                FIND_LIBRARY(BULLET_math_LIB bulletmath_d)

                FIND_LIBRARY(lib_BULLET_dynamics_LIB libbulletdynamics_d)
                FIND_LIBRARY(lib_BULLET_collision_LIB libbulletcollision_d)
                FIND_LIBRARY(lib_BULLET_softbody_LIB libbulletsoftbody_d)
                FIND_LIBRARY(lib_BULLET_linearmath_LIB liblinearmath_d)
                FIND_LIBRARY(lib_BULLET_math_LIB libbulletmath_d)

        ENDIF (NOT DEBUG)

  IF (NOT BULLET_dynamics_LIB)
    SET (BULLET_dynamics_LIB ${lib_BULLET_dynamics_LIB})
  ENDIF (NOT BULLET_dynamics_LIB)

  IF (NOT BULLET_collision_LIB)
    SET (BULLET_collision_LIB ${lib_BULLET_collision_LIB})
  ENDIF (NOT BULLET_collision_LIB)

  IF (NOT BULLET_softbody_LIB)
    SET (BULLET_softbody_LIB ${lib_BULLET_softbody_LIB})
  ENDIF (NOT BULLET_softbody_LIB)

  IF (NOT BULLET_linearmath_LIB)
    SET (BULLET_linearmath_LIB ${lib_BULLET_linearmath_LIB})
  ENDIF (NOT BULLET_linearmath_LIB)

  IF (NOT BULLET_math_LIB)
    SET (BULLET_math_LIB ${lib_BULLET_math_LIB})
  ENDIF (NOT BULLET_math_LIB)

ELSE (WIN32)

        FIND_LIBRARY(BULLET_dynamics_LIB BulletDynamics)
        FIND_LIBRARY(BULLET_collision_LIB BulletCollision)
        FIND_LIBRARY(BULLET_softbody_LIB BulletSoftBody)
        FIND_LIBRARY(BULLET_linearmath_LIB LinearMath)
        FIND_LIBRARY(BULLET_math_LIB BulletMath)

ENDIF (WIN32)



IF (NOT BULLET_math_LIB)
        SET (BULLET_math_LIB ${BULLET_linearmath_LIB})
ENDIF (NOT BULLET_math_LIB)


MESSAGE ("-- Looking for bullet dynamics ")
MESSAGE ("-- Looking for bullet dynamics - " ${BULLET_dynamics_LIB})

MESSAGE ("-- Looking for bullet collision ")
MESSAGE ("-- Looking for bullet collision - " ${BULLET_collision_LIB})

MESSAGE ("-- Looking for bullet softbody ")
MESSAGE ("-- Looking for bullet softbody - " ${BULLET_softbody_LIB})

MESSAGE ("-- Looking for bullet math ")
MESSAGE ("-- Looking for bullet math - " ${BULLET_math_LIB})


SET (BULLET_LIBRARIES   ${BULLET_dynamics_LIB}
                                                ${BULLET_collision_LIB}
                                                ${BULLET_softbody_LIB}
                                                ${BULLET_math_LIB})
